package com.example.demo;

import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
public class TextReverseController {

    private final TextReverseService textReverseService;

    public TextReverseController(TextReverseService textReverseService) {
        this.textReverseService = textReverseService;
    }

    @PostMapping("/reverse")
    public String reverseText(@RequestBody String inputText) {
        return textReverseService.reverseText(inputText);
    }

    @GetMapping("/reverse")
    public String reverseTextGet(@RequestParam String text) {
        return textReverseService.reverseText(text);
    }
}